/*
 * Copyright 2013 Agustina Martinez-Garcia

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package uk.ljmu.metadata.schemas;

import java.util.ArrayList;
import java.util.List;

import com.hp.hpl.jena.rdf.model.Model;

public class SchemaInstance {
	
	private String schemaPrefix;
	/**
	 * Used to handle custom namespace that do not need validation under Model
	 */
	private boolean validationActive;
	private List<String> additionalPrefixes;
	private String schemaURI;
	private Model model;
	/**
	 * Indicates whether to perform search over dynamic schema (accessing live to the server hosting the MD schema)
	 */
	private boolean dynamicActive;
	private List<SchemaElem> schemaElemsList;
	
	/**
	 * @param dynamicActive the dynamicActive to set
	 */
	public void setDynamicActive(boolean dynamicActive) {
		this.dynamicActive = dynamicActive;
	}
	/**
	 * @return the dynamicActive
	 */
	public boolean isDynamicActive() {
		return dynamicActive;
	}
	/**
	 * @param validationActive the validationActive to set
	 */
	public void setValidationActive(boolean validationActive) {
		this.validationActive = validationActive;
	}
	/**
	 * @return the validationActive
	 */
	public boolean isValidationActive() {
		return validationActive;
	}
	/**
	 * Sets ResourceIterator over the schema model
	 * @param modelResourceIterator
	 */
	public void setModel(Model model) {
		this.model = model;
	}
	/**
	 * 
	 * @return modelResourceIterator
	 */
	public Model getModel() {
		return model;
	}

	/**
	 * @return the additionalPrefixes
	 */
	public List<String> getAdditionalPrefixes() {
		return additionalPrefixes;
	}

	/**
	 * @param additionalPrefixes the additionalPrefixes to set
	 */
	public void setAdditionalPrefixes(List<String> additionalPrefixes) {
		this.additionalPrefixes = additionalPrefixes;
	}

	/**
	 * @return the schemaPrefix
	 */
	public String getSchemaPrefix() {
		return schemaPrefix;
	}

	/**
	 * @param schemaPrefix the schemaPrefix to set
	 */
	public void setSchemaPrefix(String schemaPrefix) {
		this.schemaPrefix = schemaPrefix;
	}

	/**
	 * @return the schemaURI
	 */
	public String getSchemaURI() {
		return schemaURI;
	}

	/**
	 * @param schemaURI the schemaURI to set
	 */
	public void setSchemaURI(String schemaURI) {
		this.schemaURI = schemaURI;
	}

	/**
	 * @return the schemaElemsList
	 */
	public List<SchemaElem> getSchemaElemsList() {
		return schemaElemsList;
	}

	/**
	 * @param schemaElemsList the schemaElemsList to set
	 */
	public void setSchemaElemsList(List<SchemaElem> schemaElemsList) {
		this.schemaElemsList = schemaElemsList;
	}

	public SchemaInstance()
	{
		this.setSchemaElemsList(new ArrayList<SchemaElem>());
		this.setAdditionalPrefixes(new ArrayList<String>());
		//Validation against Model true by default
		this.setValidationActive(true);
		//Dynamic schema parsing true by default
		this.setDynamicActive(true);
	}
	
	public SchemaInstance(List<SchemaElem> elem, List<String> strList, boolean validation, boolean dynamic)
	{
		this.setSchemaElemsList(elem);
		this.setAdditionalPrefixes(strList);
		this.setValidationActive(validation);
		this.setDynamicActive(dynamic);
	}
}
